import time

def debug_print(*args, level="INFO"):
    """带有日志级别和颜色的调试输出"""
    # ANSI颜色代码
    colors = {
        "DEBUG": "\033[94m",    # 蓝色
        "INFO": "\033[92m",     # 绿色
        "WARNING": "\033[93m",  # 黄色
        "ERROR": "\033[91m",    # 红色
    }
    
    color = colors.get(level, "\033[0m")
    reset = "\033[0m"
    timestamp = time.strftime("%H:%M:%S")
    
    print(f"{color}[{level}] {timestamp}:", *args, reset)

# 使用示例
debug_print("程序启动", level="INFO")
debug_print("读取配置文件", level="DEBUG")
debug_print("磁盘空间不足", level="WARNING")
debug_print("文件打开失败", level="ERROR")